8.7 What happens when 'n-Puzzle Game: 3 × 3' is selected?
- Motivations
- Mouse clicking
- Mouse clicking - event on an HTML element
- This event is caught in JavaScript code.
- The JavaScript code prepares the game board and displays it.
- Lab 6.
- When 'You vs computer' tic-tac-to in the next program, lab6_bgp.html, is selected (i.e., clicked), the game board is not displayed.
This is because the 'click' event on the 'You vs compuer' menu item is not properly captured and handled.
- Find the JavaScript code for the 'You vs computer' tic-tac-to game, and fix it, so that the game board is properly displayed.
- 'lab6_bgp_ttt.js' included in 'lab6_bgp.html' has an error as well.
- Let's download and complete the program.
- Learning outcomes